<template>
  <div>
     <el-select style="width:650px;" v-model="bindList"  filterable  placeholder="选择绑定用户" @change="selectChange">
         <el-option v-for="item in userInfoList" :key="item.id"
           :label="item.label" :value="item.value" />
       </el-select>
  </div>
</template>

<script lang="ts" setup>
import {  onMounted,ref } from 'vue';
import request from '/@/utils/request';
interface ListItem {
  id: number,
  key:string,
  label:string,
  value:any
}
var props = defineProps({
		paramter: {
		default: [],
	},
	info:{
		default:{}
		}
	});
let bindList=ref<any[]>()
let userInfoList=ref<any[]>()
//定义一个回调方法
const emit = defineEmits(["callBack"]);


onMounted(async() => {
	await getInfos()
	 if(props.paramter!=null&&props.paramter.length>0)
		bindList.value= props.paramter
})
const getInfos = async () => {
		  var url = `api/Common/UserInfos`
		  var res = await request({url: url,method: 'get'});
		  userInfoList.value= res.data.result;
	};
	//调用父组件的一个方法将子组件值传过去
const selectChange=(item)=>{
	emit("callBack",item);
}
</script>